package com.yf.tz.service.impl;

import com.yf.service.impl.BaseServiceImpl;
import com.yf.tz.dao.MallTypeDao;
import com.yf.tz.entity.MallTypeEntity;
import com.yf.tz.service.MallTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 订单类型Service实现类
 *
 * @author hxf
 * @email 505860922@qq.com
 * @date Wed Jul 01 16:32:18 CST 2020
 */
@Service
public class MallTypeServiceImpl extends BaseServiceImpl<MallTypeEntity> implements MallTypeService {

    private MallTypeDao mallTypeDao;


    @Autowired
    public void setDao(MallTypeDao mallTypeDao) {
        this.mallTypeDao = mallTypeDao;
        super.setBaseDao(mallTypeDao);
    }


    /**
     *
     *
     @Override List<MallTypeVo> queryListVo(MallTypeVo mallTypeVo){
     return mallTypeDao.queryListVo(mallTypeVo);
     }

     @Override MallTypeVo getVo(Long id){
     return mallTypeDao.getVo(id);
     }
     **/


    /**内部方法**/


    /**
     * 外部方法实现
     **/

    @Override
    public List<Long> findByGoods(Long goodsId) {
        return mallTypeDao.findByGoods(goodsId);
    }

    @Override
    @Transactional
    public void updateByList(Long goodsId, List<Long> typeIds) {
        mallTypeDao.deleteByGoods(goodsId);
        if(typeIds!=null&&typeIds.size()>0){
            mallTypeDao.insertByList(goodsId, typeIds);
        }
    }

    @Override
    public List<MallTypeEntity> findAll() {
        return mallTypeDao.findAll();
    }
}
